<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script src="css/jquery.min.js"></script>
	</head>
	<body>
		<h1>解析京东获取商品价格的json字符串</h1>
		<div>
			商品的编号：<span id="id"></span>
		</div>
		<div>
			商品的价格：<span id="price"></span>
		</div>
	</body>
	<script>
		$.ajax({
			async:true,
			type:"POST",
			url:"https://p.3.cn/prices/mgets",
			data:{
				// skuIDs=J_100009077449
				"skuIds":"J_100009077449"
			},
			contentType:"application/json;charset=utf-8;",
			dataType:"jsonp",
			success:function(data){
				console.log(data)
				
				var price = data[0].p;
				var id = data[0].id.substring(2);
				
				$("#id").text(id);
				$("#id").css("color","blue");
				$("#price").text(price);
				$("#price").css("color","red");
			},
			error:function(e){
				console.log(e.status);
				console.log(e.responseText);
			}
		})
	</script>
</html>
